#!/usr/bin/env bash

perp_version="2.07"
perp_hash="a2acc7425d556d9635a25addcee9edb5"

set -e -u -x
source ./tasks/helpers.sh

task_working_dir
download "http://b0llix.net/perp/distfiles/perp-$perp_version.tar.gz" "md5" "$perp_hash"
extract_download "perp-$perp_version.tar.gz"

cd "perp-$perp_version"
sed -i -e "s%BINDIR.*%BINDIR = $INSTALL_PREFIX_EMBEDDED/bin%" conf.mk
sed -i -e "s%SBINDIR.*%SBINDIR = $INSTALL_PREFIX_EMBEDDED/sbin%" conf.mk
sed -i -e "s%MANDIR.*%MANDIR = $INSTALL_PREFIX_EMBEDDED/share/man%" conf.mk
make -j"$NPROC"
make strip
make install DESTDIR="$STAGE_DIR"

stamp
